package org.go.smart;

import java.util.Map;

import org.go.smart.settings.SettingsBean;

public class JSONUtil {
	
	public static String buildTemperatures(final Map<String, String> temperatures) {
		String result = "";
		result += "{" + "\n";
		result += "\t\"temperatures\" : { " + "\n";
		for (String roomName : temperatures.keySet()) {
			result += "\t\t\"" + roomName + "\" : \"" + temperatures.get(roomName) + "\", " + "\n";
		}
		result += "\t}" + "\n";
		result += "}" + "\n";
		
		return result;
	}

	public static String buildSettings() {
		SettingsBean settingsBean = SettingsBean.getInstance();
		String result = "";
		result += "{" + "\n";
		result += "\t\"settings\" : { " + "\n";
		result += "\t\t\"temperatureThreshold\" : \"" + settingsBean.getTemperatureThreshold() + "\", " + "\n";
		result += "\t}" + "\n";
		result += "}" + "\n";
		return result;
	}
	
}
